<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateQrcodesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('qrcodes', function (Blueprint $table) {
            $table->id()->comment('微信二维码管理表');
            $table->integer('user_id')->index()->comment('用户id');
            $table->string('third_type',255)->comment('二维码类型');
            $table->string('ticket',255)->comment('二维码参数');
            $table->timestamp('expire_time')->comment('二维码有效时间');
            $table->string('qrcode_url',255)->comment('微信二维码url');
            $table->string('type')->comment('二维码所属平台1=小程序，2=公众号，3=H5');
            $table->tinyInteger('status')->default(1)->comment('状态 0是禁用 1是启用');
            $table->string('url',255)->comment('微信访问路径');
            $table->integer('scan')->comment('被扫次数');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('qrcodes');
    }
}
